/*    */ package com.newcrm.thread;
/*    */ 
/*    */ import com.newcrm.db.ConnectionManager;
/*    */ import com.newcrm.manager.LuceneManager;
/*    */ import java.sql.Connection;
/*    */ import java.sql.SQLException;
/*    */ import org.apache.commons.dbutils.DbUtils;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class LuceneThread extends Thread
/*    */ {
/* 19 */   private static Logger logger = Logger.getLogger(LuceneThread.class
/* 20 */     .getName());
/*    */ 
/* 22 */   private String filePath = null;
/* 23 */   private boolean isRebuild = false;
/*    */ 
/*    */   public LuceneThread(String filePath, boolean isRebuild) {
/* 26 */     this.filePath = filePath;
/* 27 */     this.isRebuild = isRebuild;
/*    */   }
/*    */ 
/*    */   public void run()
/*    */   {
/* 34 */     LuceneManager manager = LuceneManager.getInstance(this.filePath);
/*    */ 
/* 36 */     if (this.isRebuild) {
/* 37 */       manager.reBuildIndex();
/* 38 */       return;
/*    */     }
/*    */ 
/* 41 */     Connection conn = ConnectionManager.getInstance().getConnection();
/* 42 */     if (conn == null)
/* 43 */       return;
/*    */     try
/*    */     {
/* 46 */       manager.indexCustomers(conn, this.isRebuild);
/*    */     } finally {
/*    */       try {
/* 49 */         DbUtils.close(conn);
/*    */       } catch (SQLException e) {
/* 51 */         logger.warn("close conn failed", e);
/*    */       }
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.thread.LuceneThread
 * JD-Core Version:    0.6.1
 */